<?php
class RegionServer {
	public function getProvinceCity(){
		$province = HttpDaoManager::getRegionDao()->getProvince();
		foreach ($province as $v){
			$city[$v['id']] = HttpDaoManager::getRegionDao()->getCity($v['id']);
		}
		$data['province'] = $province;
		$data['city'] = $city;
		return $data;
	}
	public function citySelectInitial(){
		$regionData = $this->getProvinceCity();
		$data['provinceList'] = $regionData['province'];
		$data['cityList'] = $regionData['city'];
		return  ClassManager::getToos()->template('eos'.DIRECTORY_SEPARATOR.'toos'.DIRECTORY_SEPARATOR.'citySelectInitial.php',$data);
	}
	public function provinceSelect($province=0,$selectName="province",$cityName='city'){
		$data['provinceList'] = HttpDaoManager::getRegionDao()->getProvince();
		$data['province'] = $province;
		$data['selectName']=$selectName;
		$data['cityName']  = $cityName;
		return  ClassManager::getToos()->template('eos'.DIRECTORY_SEPARATOR.'toos'.DIRECTORY_SEPARATOR.'provinceSelect.php',$data);
	}
	public function citySelect($citySelectName = 'city'){
		$data['citySelectName']  = $citySelectName;
		return  ClassManager::getToos()->template('eos'.DIRECTORY_SEPARATOR.'toos'.DIRECTORY_SEPARATOR.'citySelect.php',$data);
	}
	public function selectCityProvince($province=0,$city=0,$provinceName,$cityName){
		$data['province'] = $province;
		$data['city'] = $city;
		$data['provinceName'] = $provinceName;
		$data['cityName'] = $cityName;
		return  ClassManager::getToos()->template('eos'.DIRECTORY_SEPARATOR.'toos'.DIRECTORY_SEPARATOR.'selectCityProvince.php',$data);
	} 
	public function  cityProvinceSelect($province=0,$city=0,$provinceName,$cityName){
		if (empty($province)){
			$province = 0;
		}
		if (empty($city)){
			$city =0 ;
		}
		return  $this->citySelectInitial().$this->provinceSelect($province,$provinceName,$cityName).$this->citySelect($cityName).$this->selectCityProvince($province,$city,$provinceName,$cityName);
	}
}
?>